import validate from '../../../utils/validation'

// 校验规则
const SCHEMA = {
  type: 'object',
  required: ['type', 'code', 'password', 'name'],
  properties: {
    type: {
      type: 'number',
      enum: [100, 101, 102],
    },
    code: {
      type: 'string',
      minLength: 1,
    },
    password: {
      type: 'string',
      maxLength: 255,
      minLength: 6,
    },
    name: {
      type: 'string',
      // pattern: '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'
      maxLength: 30,
      minLength: 6,
    },
  },
}
/**
 * 获取检验函数
 * @param data
 * @returns
 */
function validation(data = {}) {
  return validate(SCHEMA, data)
}
export default validation
